<?php
/**
 * Created by PhpStorm.
 * User: Frings
 * Date: 2016-04-25
 * Time: 15:42
 */

use \yii\helpers\Url;

$web = Url::to('@web');
?>


<?php
foreach ($orderList as $order) {
    ?>
    <div class="order-item-frame">
        <div class="order-info-frame">
            <img class="datetime-icon" src="<?= $web ?>/img/wx-good/order-list-datetime-icon.png">
            <label class="datetime-text"><?= $order["CREATE_DATETIME"] ?></label>
            <label class="code-text"><?= $order["CODE"] ?></label>
            <label class="status-text"><?= $order["status_text"] ?></label>
        </div>
        <div class="order-goods-frame" onclick="redirectorderDetail('<?= $order["ID"] ?>')">
            <?php
            foreach ($order["goodsList"] as $goods) {
                ?>
                <div class="goods-item-frame">
                    <img class="goods-icon" src="<?= $goods["GOODS_IMG_URL"] ?>">
                    <div class="goods-content">
                        <div class="goods-name"><?= $goods["GOODS_NAME"] ?></div>
                        <div class="goods-buy">
                            <div class="goods-integral">
                                <label>价格<br><?= sprintf('%.2f', $goods["PRICE"]) ?></label>
                            </div>
                            <div class="goods-count">
                                <label>数量<br><?= $goods["COUNT"] ?></label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="spliter"></div>

                <?php
            }
            ?>

        </div>
        <div class="order-account-frame">
            <label>&nbsp;&nbsp;&nbsp;&nbsp;</label>
            <label>元</label>
            <label class="num-text"><?= sprintf('%.2f', $order["goods_sum_price"]) ?></label>
            <label>件商品,合计</label>
            <label class="num-text"><?= $order["goods_count"] ?></label>
            <label>共</label>
        </div>

        <?php
        switch ($order['STATUS']) {
            case 1: // 未支付
                echo "<div class='spliter'></div><div class='order-operator-frame'><a onclick='redirectorderDetail(\"" . "{$order['ID']}" . "\")'>订单支付</a><a onclick='redirectorderDetail(\"" . "{$order['ID']}" . "\")'>取消订单</a></div>";
                break;
            case 2: // 支付中
                break;
            case 3: // 已支付
                break;
            case 10: // 出库中
                echo "<div class='spliter'></div><div class='order-operator-frame'><a href='javascript:searchOrderLogistics(\"" . $order['ID'] . "\")'>查看物流</a></div>";
                break;
            case 11: // 配送中
                echo "<div class='spliter'></div><div class='order-operator-frame'><a href='javascript:searchOrderLogistics(\"" . $order['ID'] . "\")'>查看物流</a></div>";
                break;
            case 12: // 配送完成
                break;
            case 20: // 已取消
                break;
            case 21: // 已完成
                break;
            case 22: // 已失效
        }
        ?>
    </div>

    <?php
}
?>
